﻿#ifndef CAMERATUCAMIMAGEPROCESSING_H
#define CAMERATUCAMIMAGEPROCESSING_H
#include "./sdk/inc/TUDefine.h"
#include "../CameraCommon/IndustryCamera.h"

namespace Qly {
class CameraTUCAMImageProcessing : public CameraImageProcessing
{
    friend class CameraTUCAM_p;
public:
    bool init(TUCAM_OPEN op);
    bool setWhiteBalanceMode(WhiteBalanceMode mode) Q_DECL_OVERRIDE;///
    bool whiteBalanceMode(WhiteBalanceMode &mode) Q_DECL_OVERRIDE;
    bool setManualWhiteBalance(double colorTemperature, double Tint) Q_DECL_OVERRIDE;
    bool manualWhiteBalance(double &colorTemperature, double &Tint) Q_DECL_OVERRIDE;
    bool setWhiteBalance(int red, int green, int blue) Q_DECL_OVERRIDE;
    bool whiteBalance(int &red, int &green, int &blue) Q_DECL_OVERRIDE;

    bool setGain(double fValue) Q_DECL_OVERRIDE;//
    bool gain(double &fValue) Q_DECL_OVERRIDE;//
    bool gainRange(double &fMin, double &fMax, double &fValue) Q_DECL_OVERRIDE;//
    bool setGainMode(GainMode mode)  Q_DECL_OVERRIDE;//
    bool gainMode(GainMode &mode) Q_DECL_OVERRIDE;

    bool brightnessEnable(bool &on) Q_DECL_OVERRIDE;
    bool setBrightnessEnable(bool on) Q_DECL_OVERRIDE;
    bool setBrightness(double value) Q_DECL_OVERRIDE;//
    bool brightness(double &nValue) Q_DECL_OVERRIDE;//
    bool brightnessRange(double &fMin, double &fMax, double &fValue);//

    bool setGamma(double v) Q_DECL_OVERRIDE;//
    bool gamma(double &v) Q_DECL_OVERRIDE;//
    bool gammaEnable(bool &on) Q_DECL_OVERRIDE;
    bool setGammaEnable(bool on) Q_DECL_OVERRIDE;
    bool gammaRange(double &fMin, double &fMax, double &fValue) Q_DECL_OVERRIDE;//

    bool setBlackLevel(double value) Q_DECL_OVERRIDE; //between -1.0 and 1.0, with a default of 0.
    bool blackLevel(double &value) Q_DECL_OVERRIDE;
    bool blackLevelEnable(bool &on) Q_DECL_OVERRIDE;
    // bool setBlackLevelEnable(bool on) Q_DECL_OVERRIDE;

    bool setContrast(double nValue) Q_DECL_OVERRIDE;//
    bool contrast(double &nValue)  Q_DECL_OVERRIDE;//
    bool contrastEnable(bool &on) Q_DECL_OVERRIDE;
    bool setContrastEnable(bool on) Q_DECL_OVERRIDE;

    bool setSaturation(double nValue) Q_DECL_OVERRIDE;//
    bool saturation(double &value) Q_DECL_OVERRIDE;//
    bool saturationEnable(bool &on) Q_DECL_OVERRIDE;
    bool setSaturationEnable(bool on) Q_DECL_OVERRIDE;

    //    virtual bool setDenoise(double value); //between -1.0 and 1.0, with a default of 0.
    //    virtual bool denoise(double &value);
    //    virtual bool denoiseEnable(bool &on);
    //    virtual bool setDenoiseEnable(bool on);

    bool setHue(double nValue) Q_DECL_OVERRIDE;//
    bool hue(double &value) Q_DECL_OVERRIDE;//
    bool hueEnable(bool &on) Q_DECL_OVERRIDE;
    bool setHueEnable(bool on) Q_DECL_OVERRIDE;

    bool setWhiteBalanceTempTint(int temp, int tint);
    bool whiteBalanceTempTint(int &temp, int &tint);
    bool whiteBalanceTempRange(int &nMin, int &nMax, int &nValue);
    bool whiteBalanceTintRange(int &nMin, int &nMax, int &nValue);

private:
    bool contrastRange(double &fMin, double &fMax, double &fValue);//
    bool hueRange(double &fMin, double &fMax, double &fValue);//
    bool saturationRange(double &fMin, double &fMax, double &fValue);//
    bool blackLevelRange(double &fMin, double &fMax, double &fValue);
private:
    TUCAM_OPEN m_opCam;

    double m_brightness_min;
    double m_brightness_max;
    double m_gain_min;
    double m_gain_max;
    double m_hue_min;
    double m_hue_max;
    double m_contrast_min;
    double m_contrast_max;
    double m_saturation_min;
    double m_saturation_max;
    double m_gamma_min;
    double m_gamma_max;
    double m_blackLevel_min;
    double m_blackLevel_max;
};

}
#endif // CAMERATUCAMIMAGEPROCESSING_H
